/**
 * <pre>
 * Title: 		Message.java
 * Project: 	MSBASE
 * Author:		pengfangliang
 * Create:	 	2012-7-2 上午10:38:41
 * Copyright: 	Copyright (c) 2012
 * Company:		Shenzhen Helper
 * <pre>
 */
package com.hengpeng.itfinbase.persist;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;

import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputPattern;
import com.hengpeng.common.web.annotation.HtmlInputType;
import com.hengpeng.itfinbase.idAssign.AbstractAssign18IdEntity;

/**
 * <pre>
 * 站内信
 * </pre>
 * 
 * @author pengfangliang
 * @version 1.0, 2012-7-2
 */
@Entity
public class Message extends AbstractAssign18IdEntity {
    /**
     * 
     */
    private static final long serialVersionUID = 8720752400190719112L;

    /**
     * <pre>
     * 发送方式
     * </pre>
     * 
     * @author pengfangliang
     * @version 1.0, 2012-7-2
     */
    public static enum MessageSendType {
        ALLMEMBER("所有用户"), SINGLEMEMBER("单个用户");

        private String text;

        MessageSendType(String text) {
            this.text = text;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }
    }

    /**
     * 内容
     */
    @HtmlInput(index = 3, label = "内容", type = HtmlInputType.TEXTAREA, nullable = false)
    private String content;

    /**
     * 消息类型
     */
    @HtmlInput(index = 4, label = "消息类型", type = HtmlInputType.SELECT, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private MessageType type;

    /**
     * 创建时间
     */
    @HtmlInput(index = 7, label = "创建时间", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.DATETIME, format = "yyyy-MM-dd HH:mm")
    private Date creatDate;

    /**
     * 开始时间(条件)
     */
    private Date startTime;

    /**
     * 截止时间(条件)
     */
    private Date endTime;

    /**
     * 是否已发布
     */
    @HtmlInput(index = 6, label = "是否已发布", type = HtmlInputType.SELECT, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private BoolValue isPublish;

    /**
     * 发布时间
     */
    @HtmlInput(index = 8, label = "发布时间", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.DATETIME, format = "yyyy-MM-dd HH:mm")
    private Date publishTime;

    /**
     * 发送类型
     */
    @HtmlInput(index = 5, label = "发送类型", type = HtmlInputType.SELECT, labelProperty = "text", nullable = false)
    @Enumerated(javax.persistence.EnumType.STRING)
    private MessageSendType sendType;

    /**
     * 摘要
     */
    @HtmlInput(index = 2, label = "摘要", type = HtmlInputType.TEXT, nullable = false)
    private String summary;

    /**
     * 发送时间(定时发送)
     */
    private Date sendTime;

    /**
     * 标题
     */
    @HtmlInput(index = 1, label = "标题", type = HtmlInputType.TEXT, nullable = false)
    private String title;

    /**
     * 用户名--可扩展
     */
    @Column(length = 2000)
    private String userName;

    /**
     * 发布时间
     */
    @HtmlInput(index = 8, label = "发布时间", type = HtmlInputType.TEXT, pattern = HtmlInputPattern.DATETIME, format = "yyyy-MM-dd HH:mm")
    private Date publishDate;

    /**
     * 阅读率(百分比)
     */
    @HtmlInput(index = 8, label = "阅读率(百分比)", type = HtmlInputType.TEXT)
    private Integer readRate;

    /**
     * 阅读人数
     */
    @HtmlInput(index = 8, label = "阅读人数", type = HtmlInputType.TEXT)
    private Integer readTotal;

    /**
     * 收件人数
     */
    @HtmlInput(index = 8, label = "收件人数", type = HtmlInputType.TEXT)
    private Integer receiverTotal;

    /**
     * 开始时间(条件)
     */
    private Date beginTime;

    /**
     * 发送人
     */
    @HtmlInput(index = 0, label = "发送人", type = HtmlInputType.TEXT)
    private String sender;

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    public static enum MessageSendConditionType {
        NEWREGIST("新用户"), TOTALANTEMONEYO("沉默用户"), TOTALIMPRESTMONEY("累计充值额范围");

        private String text;

        MessageSendConditionType(String text) {
            this.text = text;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }
    }

    /**
     * <pre>
     *   消息类型(站内信(系统自己发送) 重要通知(管理员后台发送))
     * </pre>
     * 
     * @author pengfangliang
     * @version 1.0, 2012-7-2
     */
    public static enum MessageType {
        COMMON("站内信"), IMPORTANT("重要通知");

        private String text;

        MessageType(String text) {
            this.text = text;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }
    }

    public MessageType getType() {
        return type;
    }

    public void setType(MessageType type) {
        this.type = type;
    }

    public Integer getReadRate() {
        return readRate;
    }

    public void setReadRate(Integer readRate) {
        this.readRate = readRate;
    }

    public Integer getReadTotal() {
        return readTotal;
    }

    public void setReadTotal(Integer readTotal) {
        this.readTotal = readTotal;
    }

    public Integer getReceiverTotal() {
        return receiverTotal;
    }

    public void setReceiverTotal(Integer receiverTotal) {
        this.receiverTotal = receiverTotal;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreatDate() {
        return creatDate;
    }

    public void setCreatDate(Date creatDate) {
        this.creatDate = creatDate;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public BoolValue getIsPublish() {
        return isPublish;
    }

    public void setIsPublish(BoolValue isPublish) {
        this.isPublish = isPublish;
    }

    public Date getPublishTime() {
        return publishTime;
    }

    public void setPublishTime(Date publishTime) {
        this.publishTime = publishTime;
    }

    public MessageSendType getSendType() {
        return sendType;
    }

    public void setSendType(MessageSendType sendType) {
        this.sendType = sendType;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}
